<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Lib.simple_client</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Lib-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/x-venture">x-venture</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="Lib-module.html">Package&nbsp;Lib</a> ::
        Module&nbsp;simple_client
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript: void(0);" class="privatelink"
    onclick="toggle_private();">hide private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="Lib.simple_client-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="Lib.simple_client-module.html">Module Lib.simple_client</a></h1>
<pre class="py-src">
<span class="py-lineno"> 1</span>  <span class="py-line"><span class="py-comment">#@+leo-ver=4-thin</span> </span>
<span class="py-lineno"> 2</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061019180722.3:@thin .\\Lib\simple_client.py</span> </span>
<span class="py-lineno"> 3</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@&lt;&lt; docstring &gt;&gt;</span> </span>
<span class="py-lineno"> 4</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+middle:234.20061019180722.4:headers_footers</span> </span>
<span class="py-lineno"> 5</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061019180722.5:&lt;&lt; docstring &gt;&gt;</span> </span>
<span class="py-lineno"> 6</span>  <span class="py-line"><span class="py-comment"></span><span class="py-docstring">"""An example of the simplest possible client."""</span> </span>
<span class="py-lineno"> 7</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno"> 8</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061019180722.5:&lt;&lt; docstring &gt;&gt;</span> </span>
<span class="py-lineno"> 9</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-middle:234.20061019180722.4:headers_footers</span> </span>
<span class="py-lineno">10</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@nl</span> </span>
<span class="py-lineno">11</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@@language python</span> </span>
<span class="py-lineno">12</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@@tabwidth -4</span> </span>
<span class="py-lineno">13</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@&lt;&lt; imports &gt;&gt;</span> </span>
<span class="py-lineno">14</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+middle:234.20061019180722.4:headers_footers</span> </span>
<span class="py-lineno">15</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061019180722.6:&lt;&lt; imports &gt;&gt;</span> </span>
<span class="py-lineno">16</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061019180722.6:&lt;&lt; imports &gt;&gt;</span> </span>
<span class="py-lineno">17</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-middle:234.20061019180722.4:headers_footers</span> </span>
<span class="py-lineno">18</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@nl</span> </span>
<span class="py-lineno">19</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+others</span> </span>
<span class="py-lineno">20</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061019180722.4:headers_footers</span> </span>
<span class="py-lineno">21</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@+node:234.20061024172236:class simpleclient</span> </span>
<a name="simpleclient"></a><div id="simpleclient-def"><span class="py-lineno">22</span> <a class="py-toggle" href="#" id="simpleclient-toggle" onclick="toggle('simpleclient'); return false;">-</a><span class="py-line"><span class="py-comment"></span><span class="py-keyword">class</span> <a class="py-def-name" href="Lib.simple_client.simpleclient-class.html">simpleclient</a><span class="py-op">:</span> </span>
</div><div id="simpleclient-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="simpleclient-expanded"><span class="py-lineno">23</span>  <span class="py-line">    <span class="py-docstring">"""Can receive and send basic messages."""</span> </span>
<span class="py-lineno">24</span>  <span class="py-line">     </span>
<a name="simpleclient.__init__"></a><div id="simpleclient.__init__-def"><span class="py-lineno">25</span> <a class="py-toggle" href="#" id="simpleclient.__init__-toggle" onclick="toggle('simpleclient.__init__'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.simple_client.simpleclient-class.html#__init__">__init__</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="simpleclient.__init__-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="simpleclient.__init__-expanded"><span class="py-lineno">26</span>  <span class="py-line">        <span class="py-docstring">"""IN buffer, OUT buffer, and message format."""</span> </span>
<span class="py-lineno">27</span>  <span class="py-line">         </span>
<span class="py-lineno">28</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">IN</span> <span class="py-op">=</span> <span class="py-op">[</span><span class="py-op">]</span> </span>
<span class="py-lineno">29</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">OUT</span> <span class="py-op">=</span> <span class="py-op">[</span><span class="py-op">]</span> </span>
<span class="py-lineno">30</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">MSG</span> <span class="py-op">=</span> <span class="py-op">{</span><span class="py-string">"client_ID"</span><span class="py-op">:</span><span class="py-string">"self.client"</span><span class="py-op">,</span><span class="py-string">"msgtype"</span><span class="py-op">:</span><span class="py-string">"msg"</span><span class="py-op">,</span><span class="py-string">"msg"</span><span class="py-op">:</span><span class="py-name">None</span><span class="py-op">}</span> </span>
<span class="py-lineno">31</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">client</span> <span class="py-op">=</span> <span class="py-string">"simpleclient.1"</span> </span>
</div><span class="py-lineno">32</span>  <span class="py-line">         </span>
<a name="simpleclient.create_msg"></a><div id="simpleclient.create_msg-def"><span class="py-lineno">33</span> <a class="py-toggle" href="#" id="simpleclient.create_msg-toggle" onclick="toggle('simpleclient.create_msg'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.simple_client.simpleclient-class.html#create_msg">create_msg</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">,</span> <span class="py-param">msg</span><span class="py-op">,</span> <span class="py-param">msgtype</span><span class="py-op">=</span><span class="py-string">"msg"</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="simpleclient.create_msg-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="simpleclient.create_msg-expanded"><span class="py-lineno">34</span>  <span class="py-line">        <span class="py-docstring">"""Subclass and overide this method to support others."""</span> </span>
<span class="py-lineno">35</span>  <span class="py-line">         </span>
<span class="py-lineno">36</span>  <span class="py-line">        <span class="py-name">message</span> <span class="py-op">=</span> <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">MSG</span> </span>
<span class="py-lineno">37</span>  <span class="py-line">        <span class="py-name">message</span><span class="py-op">[</span><span class="py-name">msg</span><span class="py-op">]</span> <span class="py-op">=</span> <span class="py-name">msg</span> </span>
<span class="py-lineno">38</span>  <span class="py-line">        <span class="py-keyword">return</span> <span class="py-name">message</span> </span>
</div><span class="py-lineno">39</span>  <span class="py-line">         </span>
<a name="simpleclient.message_send"></a><div id="simpleclient.message_send-def"><span class="py-lineno">40</span> <a class="py-toggle" href="#" id="simpleclient.message_send-toggle" onclick="toggle('simpleclient.message_send'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.simple_client.simpleclient-class.html#message_send">message_send</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">,</span> <span class="py-param">message</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="simpleclient.message_send-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="simpleclient.message_send-expanded"><span class="py-lineno">41</span>  <span class="py-line">        <span class="py-docstring">"""Just append to OUT, in application there would be a daemon which would parse all outputs and send them."""</span> </span>
<span class="py-lineno">42</span>  <span class="py-line">         </span>
<span class="py-lineno">43</span>  <span class="py-line">        <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">OUT</span><span class="py-op">.</span><span class="py-name">append</span><span class="py-op">(</span><span class="py-name">message</span><span class="py-op">)</span> </span>
</div><span class="py-lineno">44</span>  <span class="py-line">         </span>
<a name="simpleclient.message_recieve"></a><div id="simpleclient.message_recieve-def"><span class="py-lineno">45</span> <a class="py-toggle" href="#" id="simpleclient.message_recieve-toggle" onclick="toggle('simpleclient.message_recieve'); return false;">-</a><span class="py-line">    <span class="py-keyword">def</span> <a class="py-def-name" href="Lib.simple_client.simpleclient-class.html#message_recieve">message_recieve</a><span class="py-op">(</span><span class="py-param">self</span><span class="py-op">)</span><span class="py-op">:</span> </span>
</div><div id="simpleclient.message_recieve-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="simpleclient.message_recieve-expanded"><span class="py-lineno">46</span>  <span class="py-line">        <span class="py-docstring">"""A daemon also goes through client list and appends any messages for client to input."""</span> </span>
<span class="py-lineno">47</span>  <span class="py-line">         </span>
<span class="py-lineno">48</span>  <span class="py-line">        <span class="py-name">messages</span> <span class="py-op">=</span> <span class="py-name">self</span><span class="py-op">.</span><span class="py-name">IN</span> </span>
<span class="py-lineno">49</span>  <span class="py-line">        <span class="py-keyword">for</span> <span class="py-name">message</span> <span class="py-keyword">in</span> <span class="py-name">messages</span><span class="py-op">:</span> </span>
<span class="py-lineno">50</span>  <span class="py-line">            <span class="py-keyword">yield</span> <span class="py-name">message</span><span class="py-op">[</span><span class="py-name">msg</span><span class="py-op">]</span> </span>
</div></div><span class="py-lineno">51</span>  <span class="py-line">         </span>
<span class="py-lineno">52</span>  <span class="py-line"><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno">53</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061024172236:class simpleclient</span> </span>
<span class="py-lineno">54</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061019180722.4:headers_footers</span> </span>
<span class="py-lineno">55</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-others</span> </span>
<span class="py-lineno">56</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@nonl</span> </span>
<span class="py-lineno">57</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-node:234.20061019180722.3:@thin .\\Lib\simple_client.py</span> </span>
<span class="py-lineno">58</span>  <span class="py-line"><span class="py-comment"></span><span class="py-comment">#@-leo</span> </span>
<span class="py-lineno">59</span>  <span class="py-line"><span class="py-comment"></span> </span><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Lib-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/x-venture">x-venture</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">Generated by Epydoc
        3.0alpha3 on Tue Oct 24 18:00:00 2006</td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
